#!/usr/bin/perl -w

use strict;
use Net::SMTP;
use Data::Dumper;
use Encode 'from_to';
use FindBin '$Bin';
use lib "$Bin";
use lib "$Bin/../../perl";
use POSIX;
use MIME::Lite;

my @tos = map("$_\@qq.com",qw/510961649/);
my @ccs = map("$_\@163.com",qw/flexp2012/);

my $from = 'flexp2012@163.com';
my $mail = "邮件测试邮件测试";
my $smtp_server = 'smtp.163.com';
my $title = "邮件测试标题";


my $username = 'flexp2012@163.com'; 
my $passwd = 'test123456';
my $rcv = join(";", @tos);
my $cc = join(";", @ccs);

$title .= $_;
$mail .= $_;
my $msg = MIME::Lite->new(
    From => $from,
    To => $rcv,
	Cc => $cc,
    Subject => $title,
    Type => 'multipart/related'
);

$msg->attach(Type => 'text/html',
		Data => $mail
		);

MIME::Lite->send('smtp',
    $smtp_server, 
    Timeout=>60, 
    AuthUser=>$username,
    AuthPass=>$passwd);

eval {$msg->send();};
print "$_\n";

